<aside class="lg-side">
  <div class="panel-heading tab-bg-dark-navy-blue okr-tab-head tab-right "></div>
  <div class="inbox-body mi-h8">
    <div class="row">
      <div class="col-lg-12">
        <section class="panel">
          <header class="panel-heading add-heading">
            项目风险信息
          </header>
          <form>
            <div class="panel-body">
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">风险级别*</label>
                <div class="col-sm-10">
                  <select class="form-control" name="riskLv" id="riskLv">
                    <option value="高">高</option>
                    <option value="中">中</option>
                    <option value="低">低</option>
                  </select>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">风险和问题*</label>
                <div class="col-sm-10">
                  <select class="form-control" name="type" id="type">
                    <option value="1">开启</option>
                    <option value="0">关闭</option>
                  </select>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">风险说明*</label>
                <div class="col-sm-10">
                  <textarea class="form-control" id="riskContent" name="riskContent" placeholder="字数限制(500字以内)" maxlength="500"  onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" ></textarea>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">预规避和处理措施*</label>
                <div class="col-sm-10">
                  <textarea class="form-control" id="riskManage" name="riskManage"
                  placeholder="字数限制(500字以内)" maxlength="500" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" ></textarea>
                </div>
              </div>
              <input type="hidden" name="id" value="" id="riskId" />
              <p class="default-buttons">
                <a href="javascript:void(0);" class="button-back btn btn-info" onclick="toBack()">返回</a>
                <a href="javascript:void(0);" class="button-next  btn btn-info submit">提交</a>
              </p>
            </div>
          </form>
        </section>
      </div>
    </div>
  </div>
</aside>
<script>
  function findRiskInfo(id) {
    $certusUtils.ajax("findRiskInfo", { "id": id }, function (response) {
      var data = response.data;
      $("#riskLv").val(data.riskLv);
      $("#type").val(data.type);
      $("#riskContent").html(data.riskContent);
      $("#riskManage").html(data.riskManage);
      $("#riskId").val(data.id);
    });
  }

  function toBack() {
    toLoadHtml(4, 2);
  }
  $(".submit").on('click', function () {

    // 风险级别
    var riskLv = $("#nextStep").val();
    // 风险开启或关闭
    var riskType = $("#type").val();
    // 风险说明
    var riskContent = $("#riskContent").val();
    // 预测规避
    var riskManage = $("#riskManage").val();

    if(riskContent == "" || riskContent == null || riskContent == undefined){
      layer.msg("风险说明不能为空！");
      return;
    }
    if(riskManage == "" || riskManage == null || riskManage == undefined){
      layer.msg("预规避和处理措施不能为空！");
      return;
    }

    var arr = $("form").serializeArray();
    var data = {};
    for (var i = 0; i < arr.length; i++) {
      data[arr[i].name] = arr[i].value;
    };
    data.proId = proId;
    data.type = $("#type").val();
    $certusUtils.ajax("addRisk", { "params": JSON.stringify(data), "projId": proId }, function (response) {
      layer.msg("修改成功", { "time": 500 });
      toLoadHtml(4, 2);
    });
  })
</script>